﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace OnlineLearningSystem.Model
{
    /// <summary>
    /// 用户表
    /// </summary>
    public class User:EntityBase
    {
        /// <summary>
        /// 用户姓名
        /// </summary>
        [Display(Name = "用户姓名")]
        [StringLength(10)]
        public string userName { get; set; }

        /// <summary>
        /// 用户年龄
        /// </summary>
        [Display(Name = "用户年龄")]
        public int userAge { get; set; }

        /// <summary>
        /// 枚举状态0=="男"，1=="女"
        /// </summary>
        [Display(Name = "性别")]
        public int userSex { get; set; }

        /// <summary>
        /// 电话号码
        /// </summary>
        [Display(Name = "电话号码")]
        [StringLength(20)]
        public string userTelphone { get; set; }

        /// <summary>
        /// 枚举角色0=="管理员"，1=="维修工"，3=='学生'
        /// </summary>
        [Display(Name = "角色")]
        public int role { get; set; }

        /// <summary>
        /// 账号
        /// </summary>
        [Display(Name = "账号")]
        [StringLength(20)]
        public string account { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        [Display(Name = "密码")]
        [StringLength(20)]
        public string password { get; set; }

        /// <summary>
        /// token
        /// </summary>
        [Display(Name = "token")]
        public string token { get; set; }

        /// <summary>
        /// 枚举状态0=="启用"，1=="禁用"
        /// </summary>
        [Display(Name = "状态")]
        public int state { get; set; }

        //枚举状态0=="启用"，1=="禁用"
        public string states
        {
            get
            {
                if (state == 0)
                { return "启用"; }
                else { return "禁用"; }
            }
        }

        //枚举状态0=="男"，1=="女"
        public string ownerSexs
        {
            get
            {
                if (userSex == 0)
                { return "男"; }
                else { return "女"; }
            }
        }

        //枚举角色0=="管理员"，1=="维修工"，2=='学生'
        public string roles
        {
            get
            {
                if (role == 0)
                { return "管理员"; }
                else if (role == 1)
                { return "维修工"; }
                else { return "学生"; }
            }
        }

        /// <summary>
        /// 一个用户对应多个批次
        /// </summary>
        public virtual IList<Batch> batchs { get; set; }
    }
}
